import 'package:flutter/material.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:qyou_app/common/base.dart';
import 'package:qyou_app/page/portal/shop/GoodsItem.dart';

class ShopGoodsPage extends StatelessWidget with Base {
  final _scrollController;
  ShopGoodsPage(this._scrollController);

  Widget _goodsList() {
    return Container(
      child: Column(
        //mainAxisAlignment: MainAxisAlignment.center,
        //crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          Padding(
            padding: EdgeInsets.all(dp(2)),
            child: Image.network(
                "https://img12.360buyimg.com/n7/jfs/t1/181947/9/6748/87815/60b34b34E9ac18d9f/18986ac88fb71eac.jpg"),
          )
        ],
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      //color: Colors.red,
      padding: EdgeInsets.symmetric(horizontal: dp(5)),
      child: StaggeredGridView.countBuilder(
        shrinkWrap: true,
        primary: false,
        controller: _scrollController,
        crossAxisCount: 4,
        itemCount: 20,
        itemBuilder: (BuildContext context, int index) => index % 2 == 0 ? GoodsItem(
          img: "https://img13.360buyimg.com/n7/jfs/t1/185969/40/11675/233175/60da8a19E9d9d7a3f/ebd2d3609f202743.jpg",
          title: "兔系 古装汉服女日常少女学生百搭连衣裙女中长款复古气质改良版过膝裙子女2021",
          author: "央视新闻",
          authorUrl: "https://i2.hdslb.com/bfs/album/ee64899f70f36dea6d5eee268d084a7223f4abd7.png@180w_180h_1c.webp",
          type: index % 2 == 0 ? "EXISE" : "OTHER",
          worksAspectRatio: 1.0,
        ) : GoodsItem(
          img: "https://img11.360buyimg.com/n7/jfs/t1/190970/29/11546/180692/60e08e52Ec5d30824/86ab8d7197727003.jpg",
          title: "艾诺黛汉服女成人学生古装明制古风刺绣春夏季仙气齐胸襦裙",
          author: "人民日报",
          authorUrl: "https://i2.hdslb.com/bfs/face/58f3635496398e9c7e123734428b8cac3e089c17.jpg@180w_180h_1c.webp",
          type: index % 2 == 0 ? "EXISE" : "OTHER",
          worksAspectRatio: 1.0,
        ),
        staggeredTileBuilder: (index) => StaggeredTile.fit(2),
        mainAxisSpacing: 4.0,
        crossAxisSpacing: 4.0,
      ),
    );
  }
}
